home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1998 August / PC Plus SuperCD 50a Issue 142 (CD142a) (August 1998).iso / handson / supercede / Knowodys / Projects / Palette1 / rgb / Form1.java < prev    next >
Encoding:
Java Source  |  1998-01-19  |  6.1 KB  |  231 lines

  1. /**
  2.  * 
  3.  * You can add code anywhere in this file - except in the areas that are
  4.  * written by the editor. You should not change the relative ordering of
  5.  * the code.
  6.  * 
  7.  * You can remove this comment block or replace it with another.
  8.  * 
  9.  * @see        
  10.  * @version    
  11.  * @author    
  12.  */
  13.  
  14.  
  15. import com.supercede.forms.*;
  16. import java.util.*;
  17. import java.net.*;
  18. import java.io.*;
  19. import java.beans.*;
  20. import java.awt.event.*;
  21. import java.awt.*;
  22.  
  23. public class Form1 extends SuperCedeFrame implements Serializable
  24. {
  25.  
  26.     public Form1() throws IOException, ClassNotFoundException, ClassCastException, SuperCedeInvalidStateException
  27.     {
  28.         SuperCedeConstructor();        // Do not remove this line.
  29.     }
  30.  
  31.     public static void main(String args[])
  32.     {
  33.         // You can add code anywhere in this method.
  34.  
  35.         try
  36.         {
  37.             Form1 app = new Form1();
  38.             app.setVisible(true);
  39.         }
  40.         catch(Throwable t)
  41.         {
  42.             System.out.println("Cannot construct the form: " + t);
  43.             System.exit(1);
  44.         }
  45.     }
  46.  
  47.     public void form1WindowClosing(WindowEvent e)
  48.     {
  49.         // You can add code anywhere in this method.
  50.  
  51.         dispose();
  52.     }
  53.  
  54.     public void form1WindowClosed(WindowEvent e)
  55.     {
  56.         // You can add code anywhere in this method.
  57.  
  58.         SuperCedeWindowClosed();
  59.     }
  60.  
  61.     public void redScrollAdjustmentValueChanged(AdjustmentEvent arg0)
  62.     {
  63.         // Put event handler code here...
  64.     }
  65.  
  66. public void blueScrollAdjustmentValueChanged(AdjustmentEvent arg0)
  67.     {
  68.         // Put event handler code here...
  69.     }
  70.  
  71.     public void greenScrollAdjustmentValueChanged(AdjustmentEvent arg0)
  72.     {
  73.         // Put event handler code here...
  74.     }
  75.  
  76.     // SuperCede Begin 2.0 Form Members
  77.     // Do not remove the Begin and End markers.
  78.     // The editor will rewrite the contents of this section each time the form is saved.
  79.  
  80.     // References to Beans within the Form.
  81.  
  82.     Canvas myCanvas;
  83.     com.supercede.beans.stdawt.ScrollbarH redScroll;
  84.     com.supercede.beans.stdawt.ScrollbarH greenScroll;
  85.     com.supercede.beans.stdawt.ScrollbarH blueScroll;
  86.  
  87.     private final void SuperCedeConstructor() throws IOException, ClassNotFoundException, ClassCastException, SuperCedeInvalidStateException
  88.     {
  89.         // Construct the actual connectors to give to our base class.
  90.  
  91.         Vector connectors = new Vector(5);
  92.         connectors.addElement(new Form1WindowClosingConnector0());
  93.         connectors.addElement(new Form1WindowClosedConnector1());
  94.         connectors.addElement(new Form1EventConnector2());
  95.         connectors.addElement(new Form1EventConnector3());
  96.         connectors.addElement(new Form1EventConnector4());
  97.  
  98.         super.initializeThis(connectors);
  99.  
  100.         // Make references to Beans within the Form.
  101.  
  102.         int i = 0;
  103.  
  104.         myCanvas = (Canvas) getComponent(i++);
  105.         redScroll = (com.supercede.beans.stdawt.ScrollbarH) getComponent(i++);
  106.         greenScroll = (com.supercede.beans.stdawt.ScrollbarH) getComponent(i++);
  107.         blueScroll = (com.supercede.beans.stdawt.ScrollbarH) getComponent(i++);
  108.     }
  109.  
  110.     private final void SuperCedeWindowClosed()
  111.     {
  112.         System.exit(0);
  113.     }
  114.  
  115.     // SuperCede End 2.0 Form Members
  116. }
  117.  
  118. // SuperCede Begin 2.0 Form Connectors
  119. // Do not remove the Begin and End markers.
  120. // The editor will rewrite the contents of this section each time the form is saved.
  121.  
  122. // Connections for this Form:
  123. //    Form1WindowClosingConnector0: from Form1.windowClosing to Form1.form1WindowClosing
  124. //    Form1WindowClosedConnector1: from Form1.windowClosed to Form1.form1WindowClosed
  125. //    Form1EventConnector2: from com.supercede.beans.stdawt.ScrollbarH.adjustmentValueChanged to Form1.redScrollAdjustmentValueChanged
  126. //    Form1EventConnector3: from com.supercede.beans.stdawt.ScrollbarH.adjustmentValueChanged to Form1.greenScrollAdjustmentValueChanged
  127. //    Form1EventConnector4: from com.supercede.beans.stdawt.ScrollbarH.adjustmentValueChanged to Form1.blueScrollAdjustmentValueChanged
  128.  
  129. final class Form1WindowClosingConnector0 extends WindowAdapter implements SuperCedeConnector
  130. {
  131.     private Form1 windowClosingTarget;
  132.  
  133.     public void setWindowClosingTarget(Form1 target)
  134.     {
  135.         windowClosingTarget = target;
  136.     }
  137.  
  138.     public void windowClosing(WindowEvent arg0)
  139.     {
  140.         windowClosingTarget.form1WindowClosing(arg0);
  141.     }
  142.  
  143.     public void setTarget(Object target)
  144.     {
  145.         setWindowClosingTarget((Form1) target);
  146.     }
  147. }
  148.  
  149. final class Form1WindowClosedConnector1 extends WindowAdapter implements SuperCedeConnector
  150. {
  151.     private Form1 windowClosedTarget;
  152.  
  153.     public void setWindowClosedTarget(Form1 target)
  154.     {
  155.         windowClosedTarget = target;
  156.     }
  157.  
  158.     public void windowClosed(WindowEvent arg0)
  159.     {
  160.         windowClosedTarget.form1WindowClosed(arg0);
  161.     }
  162.  
  163.     public void setTarget(Object target)
  164.     {
  165.         setWindowClosedTarget((Form1) target);
  166.     }
  167. }
  168.  
  169. final class Form1EventConnector2 implements SuperCedeConnector, java.awt.event.AdjustmentListener
  170. {
  171.     private Form1 adjustmentValueChangedTarget;
  172.  
  173.     public void setAdjustmentValueChangedTarget(Form1 target)
  174.     {
  175.         adjustmentValueChangedTarget = target;
  176.     }
  177.  
  178.     public void adjustmentValueChanged(AdjustmentEvent arg0)
  179.     {
  180.         adjustmentValueChangedTarget.redScrollAdjustmentValueChanged(arg0);
  181.     }
  182.  
  183.     public void setTarget(Object target)
  184.     {
  185.         setAdjustmentValueChangedTarget((Form1) target);
  186.     }
  187. }
  188.  
  189. final class Form1EventConnector3 implements SuperCedeConnector, java.awt.event.AdjustmentListener
  190. {
  191.     private Form1 adjustmentValueChangedTarget;
  192.  
  193.     public void setAdjustmentValueChangedTarget(Form1 target)
  194.     {
  195.         adjustmentValueChangedTarget = target;
  196.     }
  197.  
  198.     public void adjustmentValueChanged(AdjustmentEvent arg0)
  199.     {
  200.         adjustmentValueChangedTarget.greenScrollAdjustmentValueChanged(arg0);
  201.     }
  202.  
  203.     public void setTarget(Object target)
  204.     {
  205.         setAdjustmentValueChangedTarget((Form1) target);
  206.     }
  207. }
  208.  
  209. final class Form1EventConnector4 implements SuperCedeConnector, java.awt.event.AdjustmentListener
  210. {
  211.     private Form1 adjustmentValueChangedTarget;
  212.  
  213.     public void setAdjustmentValueChangedTarget(Form1 target)
  214.     {
  215.         adjustmentValueChangedTarget = target;
  216.     }
  217.  
  218.     public void adjustmentValueChanged(AdjustmentEvent arg0)
  219.     {
  220.         adjustmentValueChangedTarget.blueScrollAdjustmentValueChanged(arg0);
  221.     }
  222.  
  223.     public void setTarget(Object target)
  224.     {
  225.         setAdjustmentValueChangedTarget((Form1) target);
  226.     }
  227. }
  228.  
  229. // The following line must be the last line in the file.
  230. // SuperCede End 2.0 Form Connectors
  231.